package com.tbit.uqbike.constant.enums;

import lombok.Getter;

/**
 * 支付渠道枚举
 *
 *
 * @author <a href="mailto:chen.chaoxiong@tbit.com.cn">ChenChaoXiong</a>
 * @since 2024/6/3
 */
public enum PaymentChannelEnum {
    WECHAT("wechat", "微信"),
    ALIPAY("alipay", "支付宝"),
    ADAPAY("adapay", "汇付")
    ;

    /**
     * 商户平台
     * 微信: wechat
     * 支付宝: alipay
     * 汇付: adapay
     */
    @Getter
    private final String channel;

    @Getter
    private final String desc;

    PaymentChannelEnum(String channel, String desc) {
        this.channel = channel;
        this.desc = desc;
    }
    public static String getDescByChannel(String channel) {
        for (PaymentChannelEnum paymentChannelEnum : values()) {
            if (paymentChannelEnum.getChannel().equals(channel)) {
                return paymentChannelEnum.getDesc();
            }
        }
        return null;
    }

    public static String getChannelByDesc(String desc) {
        for (PaymentChannelEnum paymentChannelEnum : values()) {
            if (paymentChannelEnum.getDesc().equals(desc)) {
                return paymentChannelEnum.getChannel();
            }
        }
        return null;
    }
}
